#ifndef ZHY_MUDUO_BASE_BASE_H
#define ZHY_MUDUO_BASE_BASE_H

#define DISALLOW_COPY_AND_ASSIGN_11(TypeName)   \
TypeName(const TypeName&)=delete;             \
TypeName& operator=(const TypeName&)=delete

#include <stdio.h>

#define LOG_FATAL printf("[%s:%d FATAL]", __FILE__, __LINE__);printf
#define LOG_WARN printf("[%s:%d WARN]", __FILE__, __LINE__);printf
#define LOG_TRACE printf("[%s:%d TRACE]", __FILE__, __LINE__);printf
#define LOG_ERROR printf("[%s:%d ERROR]", __FILE__, __LINE__);printf
#define LOG_INFO printf("[%s:%d INFO]", __FILE__, __LINE__);printf
#define LOG_DEBUG printf("[%s:%d DEBUG]", __FILE__, __LINE__);printf

#define LOG_SYSFATAL printf("[%s:%d SYSFATAL]", __FILE__, __LINE__);printf
#define LOG_SYSERR   printf("[%s:%d LOG_SYSERR]", __FILE__, __LINE__);printf

namespace _zhy_muduo{
#define CHECK_NOTNULL(val) \
  ::_zhy_muduo::CheckNotNull(__FILE__, __LINE__, "'" #val "' Must be non NULL", (val))

// A small helper for CHECK_NOTNULL().
template <typename T>
T* CheckNotNull(const char *file, int line, const char *names, T* ptr) {
	if (ptr == NULL) {
		LOG_ERROR("[%s:%d %s]\n", file, line, names);
	}
	return ptr;
}

template<typename To, typename From>
inline To implicit_cast(From const &f) {
    return f;
}


class noncopyable
{
protected:
#if __cplusplus >= 201103L
  noncopyable() = default;
  ~noncopyable() = default;
#else
  noncopyable() {}
  ~noncopyable() {}
#endif

#if __cplusplus >= 201103L
  noncopyable( const noncopyable& ) = delete;
  noncopyable& operator=( const noncopyable& ) = delete;
#else
private:  // emphasize the following members are private
  noncopyable( const noncopyable& );
  noncopyable& operator=( const noncopyable& );
#endif
};

}//namespace _zhy_muduo

#endif //ZHY_MUDUO_BASE_BASE_H